package com.dtu.snapdroid;

import java.util.ArrayList;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

/** Class Must extends with Dialog */
/** Implement onClickListener to dismiss dialog when OK Button is pressed */
public class TagApplier extends Dialog {

	TextView testView;
	ListView listView;
	ArrayList<String> mytaglist;

	public TagApplier(final Context context, final ArrayList<String> taglist) {
		super(context);
		mytaglist = taglist;

		/** 'Window.FEATURE_NO_TITLE' - Used to hide the title */
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		/** Design the dialog in main.xml file */
		setContentView(R.layout.tagapplier);
		listView = (ListView) findViewById(R.id.tags);
		listView.setAdapter(new ArrayAdapter<String>(context, R.layout.listitem, mytaglist));
		listView.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
				SnapMain.tagApplierResult = mytaglist.get(position);
				dismiss();
			}
		});
	}
}

